function plotcylinder(x0, y0, z0, r, h,alpha,color)
    % 定义角度范围
    theta = linspace(0, 2*pi, 100);
    % 圆柱的高度范围
    z = linspace(z0, z0+h, 100);

    % 创建网格
    [THETA, Z] = meshgrid(theta, z);

    % 参数化方程计算圆柱表面点
    X = x0 + r * cos(THETA);
    Y = y0 + r * sin(THETA);

    % 绘制圆柱面
    surf(X, Y, Z, 'EdgeColor','none','FaceColor',color,'FaceAlpha',alpha);
    % 绘制底面（z = z0）
    fill3(x0 + r * cos(theta), y0 + r * sin(theta), z0 * ones(size(theta)),color, 'FaceAlpha', alpha, 'EdgeColor', 'black');

    % 绘制顶面（z = z0 + h）
    fill3(x0 + r * cos(theta), y0 + r * sin(theta), (z0+h) * ones(size(theta)),color, 'FaceAlpha', alpha, 'EdgeColor', 'black');
end